package com.sparrow.common;

import com.sparrow.common.reload.ReloadMonitor;
import com.sparrow.common.thread.IdExecutorGroup;
import com.sparrow.common.thread.IoThreadPool;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.support.DefaultConversionService;

@Configuration
@ComponentScan({
        "com.sparrow.common",
        "com.sparrow.actor"
})
public class SparrowCommonAutoConfig {
    @Bean
    public IdExecutorGroup idExecutorGroup() {
        return new IdExecutorGroup();
    }

    @Bean
    public IoThreadPool ioThreadPool() {
        return new IoThreadPool();
    }

    @Bean
    public DefaultConversionService defaultConversionService() {
        return new DefaultConversionService();
    }

    @Bean
    public ReloadMonitor watchMonitor(IdExecutorGroup idExecutorGroup) {
        ReloadMonitor reloadMonitor = ReloadMonitor.getInstance();
        return reloadMonitor;
    }
}

